<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<%@page import="Kontroller.Oversikt, Problemdomeneklasser.Sporsmaal" %>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <script src="resources/js/jquery.min.js"></script>
        <script src="resources/js/jquery.jqplot.min.js"></script>
        <script src="resources/js/jqplot.pieRenderer.min.js"></script>
        <link href="resources/css/jquery.jqplot.min.css" rel="stylesheet" type="text/css" />

        <script>
            $(document).ready(function(){
            <%
                String lenke = request.getParameter("sLenke");
                Oversikt o = new Oversikt();
                Sporsmaal s = o.hentSporsmaalURL(lenke);
                System.out.println(s);
            %>
                    var s = <%=s.toJavaScript()%>;
                    var data = new Array();
                    var a = s.altArray;
                    for(var i=0;i<a.length;i++){
                        data[i] = [a[i].navn + ") " + a[i].tekst, parseInt(a[i].antall_valgt)];                    
                    }
                
                    plot2 = jQuery.jqplot ('chart', [data],{
                        
                        seriesDefaults: {
                            renderer: jQuery.jqplot.PieRenderer,
                            rendererOptions: {
                                // Turn off filling of slices.
                                fill: true,
                                showDataLabels: true,
                                // Add a margin to seperate the slices.
                                sliceMargin: 4,
                                // stroke the slices with a little thicker line.
                                lineWidth: 5
                            }
                            
                        },
                        legend: { show:true, location: 'e' },
                        highlighter: { show: false },
                        cursor: {showTooltip: false}
                    });
                });
        </script>
    </head>
    <body>
        <form id="form1">
            <figure id="chart"></figure>
        </form>

